package com.googlecode.jvmpart.test;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

import com.googlecode.jvmpart.proc.JvmProcessException;
import com.googlecode.jvmpart.proc.jdbc.SimpleRowProcessor;

public class MyJDBCProcess extends SimpleRowProcessor {
	private static final String TEST_SQL = "SELECT * FROM DB LIMIT ?, ?";
	@Override
	public void preparedStatement(PreparedStatement ps, Map<String, String> params)
			throws SQLException {
		int start = Integer.parseInt(params.get(PARAM_START));
		int limit = Integer.parseInt(params.get(PARAM_LIMIT));
		int offset = 1;
		ps.setInt(offset++, start);
		ps.setInt(offset++, limit);
		
	}
	@Override
	public String getQuerySql() {
		return TEST_SQL;
	}
	@Override
	public void rowProcess(ResultSet rs, long row) throws JvmProcessException {

		System.out.println("processing row"+row);
		
	}

}
